To determine the local name of the visitor's computer with JavaScript, insert the following code in your HTML page:
<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
netscapeTest = parseInt(navigator.appVersion)
explorerTest = navigator.appName.indexOf("Microsoft") + 1
function netscapeThree() {
if (navigator.javaEnabled()) {
userDomain = java.net.InetAddress.getLocalHostName()
return (userDomain.toString())
} else {
return null
}
}
function netscapeFour() {
if (navigator.javaEnabled()) {
baseAddress = java.net.InetAddress.getLocalHost()
userDomain = baseAddress.getHostName()
return (userDomain.toString())
} else {
return null
}
}
if ((explorerTest == "0") && (netscapeTest == "3")) {
domainName = netscapeThree()
}
else if ((explorerTest == "0") && (netscapeTest >= "4")) {
domainName = netscapeFour()
}
else {
domainName = "using Internet Explorer? Then I don\'t know what your IP address is." }
alert('Are you realy ' + domainName + ' ?')
// End -->
</SCRIPT>
You can replace text marked by red colour.